
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace ProductKeysWin
{
    /// <summary>
    /// Interaction logic for EditDialog.xaml
    /// </summary>

    public partial class EditDialog : System.Windows.Window
    {
        private ProductKey _Key;

        private ProductKey _OldKey;

        public ProductKey OldKey
        {
            get { return _OldKey; }
        }

        public ProductKey Key
        {
            get { return _Key; }
            set
            {
                _Key = value;
                _OldKey = new ProductKey { Name = value.Name, Key = value.Key, DateClaimed = value.DateClaimed };
            }
        }
        public EditDialog()
        {
            InitializeComponent();
            ShowInTaskbar = false;
            WindowStartupLocation = WindowStartupLocation.CenterOwner;
        }

        protected void WindowLoaded(object sender, RoutedEventArgs e)
        {
            DataContext = _Key;
        }

        protected void CancelButtonClick(object sender, RoutedEventArgs e)
        {
            _Key = null;
            this.Close();
        }

        protected void OkButtonClick(object sender, RoutedEventArgs e)
        {
            this.Close();
        }
    }
}